\hypertarget{classMJ__Interface}{}\doxysection{M\+J\+\_\+\+Interface Class Reference}
\label{classMJ__Interface}\index{MJ\_Interface@{MJ\_Interface}}


Mujoco interface controls the interaction between motion controller and mujoco simulation.  




{\ttfamily \#include $<$M\+J\+\_\+interface.\+h$>$}

\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classMJ__Interface_a8673f6877a73148a67de90726d77e01a}{M\+J\+\_\+\+Interface}} (mj\+Model $\ast$mj\+\_\+model\+In, mj\+Data $\ast$mj\+\_\+data\+In)
\begin{DoxyCompactList}\small\item\em Construct a new mj interface object. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classMJ__Interface_af70216da714e571369d9d176571590a6}{update\+Sensor\+Values}} ()
\begin{DoxyCompactList}\small\item\em update all the sensors value on the robot \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classMJ__Interface_a820f45e54c3d726aa5631c2acfcf6cbd}{set\+Motors\+Torque}} (std\+::vector$<$ double $>$ \&tau\+In)
\begin{DoxyCompactList}\small\item\em Set the Motors Torque. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classMJ__Interface_ac13217e183325898b7a7e184470562f0}{data\+Bus\+Write}} (\mbox{\hyperlink{structDataBus}{Data\+Bus}} \&bus\+In)
\begin{DoxyCompactList}\small\item\em write the updated data to data\+Bus \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{classMJ__Interface_a5e8510564e538fa386a818f6f96a5121}\label{classMJ__Interface_a5e8510564e538fa386a818f6f96a5121}} 
int \mbox{\hyperlink{classMJ__Interface_a5e8510564e538fa386a818f6f96a5121}{joint\+Num}} \{0\}
\begin{DoxyCompactList}\small\item\em number of joints \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classMJ__Interface_a3323cee5ccf158f098d43752aa0c749c}\label{classMJ__Interface_a3323cee5ccf158f098d43752aa0c749c}} 
std\+::vector$<$ double $>$ \mbox{\hyperlink{classMJ__Interface_a3323cee5ccf158f098d43752aa0c749c}{motor\+\_\+pos}}
\begin{DoxyCompactList}\small\item\em current motor position \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classMJ__Interface_a2c2a122a4aa9542421e227e6c1722e3e}\label{classMJ__Interface_a2c2a122a4aa9542421e227e6c1722e3e}} 
std\+::vector$<$ double $>$ \mbox{\hyperlink{classMJ__Interface_a2c2a122a4aa9542421e227e6c1722e3e}{motor\+\_\+pos\+\_\+\+Old}}
\begin{DoxyCompactList}\small\item\em last motor position \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classMJ__Interface_ad6b575d76a968ffdda312686be04b826}\label{classMJ__Interface_ad6b575d76a968ffdda312686be04b826}} 
std\+::vector$<$ double $>$ \mbox{\hyperlink{classMJ__Interface_ad6b575d76a968ffdda312686be04b826}{motor\+\_\+vel}}
\begin{DoxyCompactList}\small\item\em motor velocity \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classMJ__Interface_a62d68e65d389ff62f9c7c95f786f094c}\label{classMJ__Interface_a62d68e65d389ff62f9c7c95f786f094c}} 
double \mbox{\hyperlink{classMJ__Interface_a62d68e65d389ff62f9c7c95f786f094c}{rpy}} \mbox{[}3\mbox{]} \{0\}
\begin{DoxyCompactList}\small\item\em roll,pitch and yaw of baselink \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classMJ__Interface_a14cefc3f8d3c18ed5b2c435ac7d959ea}\label{classMJ__Interface_a14cefc3f8d3c18ed5b2c435ac7d959ea}} 
double \mbox{\hyperlink{classMJ__Interface_a14cefc3f8d3c18ed5b2c435ac7d959ea}{base\+Quat}} \mbox{[}4\mbox{]} \{0\}
\begin{DoxyCompactList}\small\item\em in quat, mujoco order is \mbox{[}w,x,y,z\mbox{]}, here we rearrange to \mbox{[}x,y,z,w\mbox{]} \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classMJ__Interface_ab67f241caf2e6ca0388154a2c578d624}\label{classMJ__Interface_ab67f241caf2e6ca0388154a2c578d624}} 
double \mbox{\hyperlink{classMJ__Interface_ab67f241caf2e6ca0388154a2c578d624}{f3d}} \mbox{[}3\mbox{]}\mbox{[}2\mbox{]} \{0\}
\begin{DoxyCompactList}\small\item\em 3D foot-\/end contact force, L for 1st col, R for 2nd col \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classMJ__Interface_a91f7d6a50267e9ff1537328a40d68775}\label{classMJ__Interface_a91f7d6a50267e9ff1537328a40d68775}} 
double \mbox{\hyperlink{classMJ__Interface_a91f7d6a50267e9ff1537328a40d68775}{base\+Pos}} \mbox{[}3\mbox{]} \{0\}
\begin{DoxyCompactList}\small\item\em position of baselink, in world frame \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classMJ__Interface_a80db73384f82c7fc7509a66e35df0a23}\label{classMJ__Interface_a80db73384f82c7fc7509a66e35df0a23}} 
double \mbox{\hyperlink{classMJ__Interface_a80db73384f82c7fc7509a66e35df0a23}{base\+Acc}} \mbox{[}3\mbox{]} \{0\}
\begin{DoxyCompactList}\small\item\em acceleration of baselink, in body frame \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classMJ__Interface_a021529e1a992fa8c4151a3c61b952056}\label{classMJ__Interface_a021529e1a992fa8c4151a3c61b952056}} 
double \mbox{\hyperlink{classMJ__Interface_a021529e1a992fa8c4151a3c61b952056}{base\+Ang\+Vel}} \mbox{[}3\mbox{]} \{0\}
\begin{DoxyCompactList}\small\item\em angular velocity of baselink, in body frame \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classMJ__Interface_a515b7c4b0412a629fd8e2d8b7ff82012}\label{classMJ__Interface_a515b7c4b0412a629fd8e2d8b7ff82012}} 
double \mbox{\hyperlink{classMJ__Interface_a515b7c4b0412a629fd8e2d8b7ff82012}{base\+Lin\+Vel}} \mbox{[}3\mbox{]} \{0\}
\begin{DoxyCompactList}\small\item\em linear velocity of baselink, in body frame \end{DoxyCompactList}\item 
const std\+::vector$<$ std\+::string $>$ \mbox{\hyperlink{classMJ__Interface_a5cde9d9e1ab09a14e228a5df57e327f7}{Joint\+Name}}
\begin{DoxyCompactList}\small\item\em joint names list \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classMJ__Interface_a6e59db58240c350c3e5fdaa1addcc969}\label{classMJ__Interface_a6e59db58240c350c3e5fdaa1addcc969}} 
const std\+::string \mbox{\hyperlink{classMJ__Interface_a6e59db58240c350c3e5fdaa1addcc969}{base\+Name}} = \char`\"{}base\+\_\+link\char`\"{}
\begin{DoxyCompactList}\small\item\em baselink name \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classMJ__Interface_aa3e4c8f5df56bd3407a04c0ae6a15d79}\label{classMJ__Interface_aa3e4c8f5df56bd3407a04c0ae6a15d79}} 
const std\+::string \mbox{\hyperlink{classMJ__Interface_aa3e4c8f5df56bd3407a04c0ae6a15d79}{orientation\+Sensor\+Name}} = \char`\"{}baselink-\/quat\char`\"{}
\begin{DoxyCompactList}\small\item\em orientation sensor name \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classMJ__Interface_ab5e87c8106ed161dbb4533f20cc35057}\label{classMJ__Interface_ab5e87c8106ed161dbb4533f20cc35057}} 
const std\+::string \mbox{\hyperlink{classMJ__Interface_ab5e87c8106ed161dbb4533f20cc35057}{vel\+Sensor\+Name}} = \char`\"{}baselink-\/velocity\char`\"{}
\begin{DoxyCompactList}\small\item\em velocity sensor name \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classMJ__Interface_a47e131e382abab397483dfe54045d07b}\label{classMJ__Interface_a47e131e382abab397483dfe54045d07b}} 
const std\+::string \mbox{\hyperlink{classMJ__Interface_a47e131e382abab397483dfe54045d07b}{gyro\+Sensor\+Name}} = \char`\"{}baselink-\/gyro\char`\"{}
\begin{DoxyCompactList}\small\item\em gyroscope sensor name \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classMJ__Interface_a12b68aed8f3ca981ce80aae25d5c9073}\label{classMJ__Interface_a12b68aed8f3ca981ce80aae25d5c9073}} 
const std\+::string \mbox{\hyperlink{classMJ__Interface_a12b68aed8f3ca981ce80aae25d5c9073}{acc\+Sensor\+Name}} = \char`\"{}baselink-\/\mbox{\hyperlink{classMJ__Interface_a80db73384f82c7fc7509a66e35df0a23}{base\+Acc}}\char`\"{}
\begin{DoxyCompactList}\small\item\em acceleration sensor name \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Mujoco interface controls the interaction between motion controller and mujoco simulation. 



Definition at line 19 of file M\+J\+\_\+interface.\+h.



\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{classMJ__Interface_a8673f6877a73148a67de90726d77e01a}\label{classMJ__Interface_a8673f6877a73148a67de90726d77e01a}} 
\index{MJ\_Interface@{MJ\_Interface}!MJ\_Interface@{MJ\_Interface}}
\index{MJ\_Interface@{MJ\_Interface}!MJ\_Interface@{MJ\_Interface}}
\doxysubsubsection{\texorpdfstring{MJ\_Interface()}{MJ\_Interface()}}
{\footnotesize\ttfamily M\+J\+\_\+\+Interface\+::\+M\+J\+\_\+\+Interface (\begin{DoxyParamCaption}\item[{mj\+Model $\ast$}]{mj\+\_\+model\+In,  }\item[{mj\+Data $\ast$}]{mj\+\_\+data\+In }\end{DoxyParamCaption})}



Construct a new mj interface object. 


\begin{DoxyParams}{Parameters}
{\em mj\+\_\+model\+In} & mujoco model pointer \\
\hline
{\em mj\+\_\+data\+In} & mujoco data pointer \\
\hline
\end{DoxyParams}


Definition at line 10 of file M\+J\+\_\+interface.\+cpp.



References acc\+Sensor\+Name, base\+Name, gyro\+Sensor\+Name, Joint\+Name, joint\+Num, motor\+\_\+pos, motor\+\_\+pos\+\_\+\+Old, motor\+\_\+vel, orientation\+Sensor\+Name, and vel\+Sensor\+Name.



\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classMJ__Interface_ac13217e183325898b7a7e184470562f0}\label{classMJ__Interface_ac13217e183325898b7a7e184470562f0}} 
\index{MJ\_Interface@{MJ\_Interface}!dataBusWrite@{dataBusWrite}}
\index{dataBusWrite@{dataBusWrite}!MJ\_Interface@{MJ\_Interface}}
\doxysubsubsection{\texorpdfstring{dataBusWrite()}{dataBusWrite()}}
{\footnotesize\ttfamily void M\+J\+\_\+\+Interface\+::data\+Bus\+Write (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structDataBus}{Data\+Bus}} \&}]{bus\+In }\end{DoxyParamCaption})}



write the updated data to data\+Bus 


\begin{DoxyParams}{Parameters}
{\em bus\+In} & \\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
shoule calling \mbox{\hyperlink{classMJ__Interface_af70216da714e571369d9d176571590a6}{update\+Sensor\+Values()}} first 
\end{DoxyNote}


Definition at line 85 of file M\+J\+\_\+interface.\+cpp.



References base\+Acc, Data\+Bus\+::base\+Acc, base\+Ang\+Vel, Data\+Bus\+::base\+Ang\+Vel, base\+Lin\+Vel, Data\+Bus\+::base\+Lin\+Vel, base\+Pos, Data\+Bus\+::base\+Pos, f3d, Data\+Bus\+::fL, Data\+Bus\+::fR, motor\+\_\+pos, motor\+\_\+vel, Data\+Bus\+::motors\+\_\+pos\+\_\+cur, Data\+Bus\+::motors\+\_\+vel\+\_\+cur, rpy, Data\+Bus\+::rpy, and Data\+Bus\+::update\+Q().

\mbox{\Hypertarget{classMJ__Interface_a820f45e54c3d726aa5631c2acfcf6cbd}\label{classMJ__Interface_a820f45e54c3d726aa5631c2acfcf6cbd}} 
\index{MJ\_Interface@{MJ\_Interface}!setMotorsTorque@{setMotorsTorque}}
\index{setMotorsTorque@{setMotorsTorque}!MJ\_Interface@{MJ\_Interface}}
\doxysubsubsection{\texorpdfstring{setMotorsTorque()}{setMotorsTorque()}}
{\footnotesize\ttfamily void M\+J\+\_\+\+Interface\+::set\+Motors\+Torque (\begin{DoxyParamCaption}\item[{std\+::vector$<$ double $>$ \&}]{tau\+In }\end{DoxyParamCaption})}



Set the Motors Torque. 


\begin{DoxyParams}{Parameters}
{\em tau\+In} & the control torque of all the motors \\
\hline
\end{DoxyParams}


Definition at line 80 of file M\+J\+\_\+interface.\+cpp.



References joint\+Num.

\mbox{\Hypertarget{classMJ__Interface_af70216da714e571369d9d176571590a6}\label{classMJ__Interface_af70216da714e571369d9d176571590a6}} 
\index{MJ\_Interface@{MJ\_Interface}!updateSensorValues@{updateSensorValues}}
\index{updateSensorValues@{updateSensorValues}!MJ\_Interface@{MJ\_Interface}}
\doxysubsubsection{\texorpdfstring{updateSensorValues()}{updateSensorValues()}}
{\footnotesize\ttfamily void M\+J\+\_\+\+Interface\+::update\+Sensor\+Values (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



update all the sensors value on the robot 

these are joint sensors, orientation sensor, velocity sensor, gyroscope sensor, acceleration sensor and assumed position sensor 

Definition at line 52 of file M\+J\+\_\+interface.\+cpp.



References base\+Acc, base\+Ang\+Vel, base\+Lin\+Vel, base\+Pos, base\+Quat, joint\+Num, motor\+\_\+pos, motor\+\_\+pos\+\_\+\+Old, motor\+\_\+vel, and rpy.



\doxysubsection{Member Data Documentation}
\mbox{\Hypertarget{classMJ__Interface_a5cde9d9e1ab09a14e228a5df57e327f7}\label{classMJ__Interface_a5cde9d9e1ab09a14e228a5df57e327f7}} 
\index{MJ\_Interface@{MJ\_Interface}!JointName@{JointName}}
\index{JointName@{JointName}!MJ\_Interface@{MJ\_Interface}}
\doxysubsubsection{\texorpdfstring{JointName}{JointName}}
{\footnotesize\ttfamily const std\+::vector$<$std\+::string$>$ M\+J\+\_\+\+Interface\+::\+Joint\+Name}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{= \{\textcolor{stringliteral}{"J\_arm\_l\_01"}, \textcolor{stringliteral}{"J\_arm\_l\_02"}, \textcolor{stringliteral}{"J\_arm\_l\_03"}, \textcolor{stringliteral}{"J\_arm\_l\_04"}, \textcolor{stringliteral}{"J\_arm\_l\_05"},}
\DoxyCodeLine{                                                \textcolor{stringliteral}{"J\_arm\_l\_06"}, \textcolor{stringliteral}{"J\_arm\_l\_07"}, \textcolor{stringliteral}{"J\_arm\_r\_01"}, \textcolor{stringliteral}{"J\_arm\_r\_02"}, \textcolor{stringliteral}{"J\_arm\_r\_03"},}
\DoxyCodeLine{                                                \textcolor{stringliteral}{"J\_arm\_r\_04"}, \textcolor{stringliteral}{"J\_arm\_r\_05"}, \textcolor{stringliteral}{"J\_arm\_r\_06"}, \textcolor{stringliteral}{"J\_arm\_r\_07"},}
\DoxyCodeLine{                                                \textcolor{stringliteral}{"J\_head\_yaw"}, \textcolor{stringliteral}{"J\_head\_pitch"}, \textcolor{stringliteral}{"J\_waist\_pitch"}, \textcolor{stringliteral}{"J\_waist\_roll"}, \textcolor{stringliteral}{"J\_waist\_yaw"},}
\DoxyCodeLine{                                                \textcolor{stringliteral}{"J\_hip\_l\_roll"}, \textcolor{stringliteral}{"J\_hip\_l\_yaw"}, \textcolor{stringliteral}{"J\_hip\_l\_pitch"}, \textcolor{stringliteral}{"J\_knee\_l\_pitch"},}
\DoxyCodeLine{                                                \textcolor{stringliteral}{"J\_ankle\_l\_pitch"}, \textcolor{stringliteral}{"J\_ankle\_l\_roll"}, \textcolor{stringliteral}{"J\_hip\_r\_roll"}, \textcolor{stringliteral}{"J\_hip\_r\_yaw"},}
\DoxyCodeLine{                                                \textcolor{stringliteral}{"J\_hip\_r\_pitch"}, \textcolor{stringliteral}{"J\_knee\_r\_pitch"}, \textcolor{stringliteral}{"J\_ankle\_r\_pitch"}, \textcolor{stringliteral}{"J\_ankle\_r\_roll"}\}}

\end{DoxyCode}


joint names list 



Definition at line 34 of file M\+J\+\_\+interface.\+h.



Referenced by M\+J\+\_\+\+Interface().



The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
M\+J\+\_\+interface.\+h\item 
M\+J\+\_\+interface.\+cpp\end{DoxyCompactItemize}
